package com.love.cloud.common.mybatis.method;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;

/**
 * 自定义逻辑删除全部方法
 * @author hongdongqu
 * @version 1.0
 */
public class DeletePhysicsByIdMethod extends AbstractMethod {
    @Override
    public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
        //执行的sql
        String sql="DELETE FROM "+ tableInfo.getTableName()+" ${ew.customSqlSegment}";
        //mapper接口方法名
        String method="deletePhysicsById";
        SqlSource sqlSource=languageDriver.createSqlSource(configuration,sql,modelClass);
        return addDeleteMappedStatement(mapperClass,method,sqlSource);
    }
}
